
namespace ShoppingCart.Business.Logic
{
	using System;
	using System.Collections.Generic;
	using ShoppingCart.Business.Entity;
	using ShoppingCart.DataAccess;

	/// <summary>
	/// Represents the Manager of Cliente.
	/// </summary>
	[Serializable]
	public class ClienteManager : Singleton<ClienteManager>
	{
		#region Methods

		/// <summary>
		/// Selects all records from the Cliente table.
		/// </summary>
		public IList<Cliente> Listar()
		{
			try
			{
				return ClienteData.Instancia.Listar();
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Selects a single record from the Cliente table.
		/// </summary>
		public Cliente Obtener(int idCliente)
		{
			try
			{
				return ClienteData.Instancia.Obtener(idCliente);
			}
			catch (Exception) { throw; }
		}

        public Cliente ObtenerPorDni(string dni)
        {
            try
            {
                return ClienteData.Instancia.ObtenerPorDni(dni);
            }
            catch (Exception) { throw; }
        }

        public Cliente ObtenerPorRuc(string ruc)
        {
            try
            {
                return ClienteData.Instancia.ObtenerPorRuc(ruc);
            }
            catch (Exception) { throw; }
        }

	    public Cliente ObtenerPorGuid(Guid guid)
        {
            try
            {
                return ClienteData.Instancia.ObtenerPorGuid(guid);
            }
            catch (Exception) { throw; }
        }

	    /// <summary>
		/// Selects all records from the Cliente table by a foreign key.
		/// </summary>
		public IList<Cliente> ListarPorIdDistrito(int idDistrito)
		{
			try
			{
				return ClienteData.Instancia.ListarPorIdDistrito(idDistrito);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Saves a record to the Cliente table.
		/// </summary>
		public int Agregar(Cliente cliente)
		{
			try
			{
				return ClienteData.Instancia.Agregar(cliente);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Updates a record in the Cliente table.
		/// </summary>
		public bool Modificar(Cliente cliente)
		{
			try
			{
				return ClienteData.Instancia.Modificar(cliente);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Deletes a record from the Cliente table by its primary key.
		/// </summary>
		public bool Eliminar(int idCliente)
		{
			try
			{
				return ClienteData.Instancia.Eliminar(idCliente);
			}
			catch (Exception) { throw; }
		}

		/// <summary>
		/// Deletes a record from the Cliente table by a foreign key.
		/// </summary>
		public void EliminarPorIdDistrito(int idDistrito)
		{
			try
			{
				ClienteData.Instancia.EliminarPorIdDistrito(idDistrito);
			}
			catch (Exception) { throw; }
		}

		#endregion
	}
}
